#!/usr/bin/env python3
# _*_ coding:utf-8 _*_


from django.conf.urls import url
from rbac.views import User
from rbac.views import Role
from rbac.views import Menu
from rbac.views import Account
from rbac.views import Icon

urlpatterns = [
    url(r'^user/$', User.user_list, name='users'),
    url(r'^user/add/$', User.user_add, name='user_add'),
    url(r'^user/edit/(?P<pk>\d+)/$', User.user_edit, name='user_edit'),
    url(r'^user/del/(?P<pk>\d+)/$', User.user_del, name='user_del'),

    url(r'^role/$', Role.role_list, name='roles'),
    url(r'^role/add/$', Role.role_add, name='role_add'),
    url(r'^role/edit/(?P<pk>\d+)/$', Role.role_edit, name='role_edit'),
    url(r'^role/del/(?P<pk>\d+)/$', Role.role_del, name='role_del'),

    url(r'^icon/$', Icon.icon_list, name='icons'),
    url(r'^icon/add/$', Icon.icon_add, name='icon_add'),
    url(r'^icon/edit/(?P<pk>\d+)/$', Icon.icon_edit, name='icon_edit'),
    url(r'^icon/del/(?P<pk>\d+)/$', Icon.icon_del, name='icon_del'),

    url(r'^menu/$', Menu.menu_list, name='menus'),
    url(r'^menu/add/$', Menu.menu_add, name='menu_add'),
    url(r'^menu/edit/(?P<pk>\d+)/$', Menu.menu_edit, name='menu_edit'),
    url(r'^menu/del/(?P<pk>\d+)/$', Menu.menu_del, name='menu_del'),

    url(r'^second/menu/add/(?P<menu_id>\d+)/$', Menu.second_menu_add, name='second_menu_add'),
    url(r'^second/menu/edit/(?P<pk>\d+)/$', Menu.second_menu_edit, name='second_menu_edit'),
    url(r'^second/menu/del/(?P<pk>\d+)/$', Menu.second_menu_del, name='second_menu_del'),

    url(r'^permission/add/(?P<second_menu_id>\d+)/$', Menu.permission_add, name='permission_add'),
    url(r'^permission/edit/(?P<pk>\d+)/$', Menu.permission_edit, name='permission_edit'),
    url(r'^permission/del/(?P<pk>\d+)/$', Menu.permission_del, name='permission_del'),

    url(r'^multi/permissions/$', Menu.multi_permissions, name='multi_permissions'),
    url(r'^multi/permissions/del/(?P<pk>\d+)/$', Menu.multi_permissions_del, name='multi_permissions_del'),

    url(r'^distribute/permissions/$', Menu.distribute_permissions, name='distribute_permissions'),

    url(r'^login/$', Account.login, name='login'),
    url(r'^logout/$', Account.logout, name='logout'),
    url(r'^resetpasswd/(?P<pk>\d+)/$', Account.resetpasswd, name='resetpasswd'),
    url(r'^changepasswd/$', User.change_passwd, name='changepasswd'),
]
